<template>
  <view class="container">
    <Navbar style="width: 90vw;"/>
    <Banner :banners="banners" style="width: 90vw;"/>
    <ServiceArea style="width: 90vw;"/>
    <FeatureArea style="width: 90vw;"/>
    <GroupArea style="width: 90vw;"/>
    <RecommendArea style="width: 90vw;"/>

  </view>
</template>

<script setup>
import Navbar from './components/Navbar.vue'
import Banner from './components/Banner.vue'
import ServiceArea from './components/ServiceArea.vue'
import FeatureArea from './components/FeatureArea.vue'
import RecommendArea from './components/RecommendArea.vue'
import GroupArea from './components/GroupArea.vue'
import {form, login} from "../../common/api";
import {onLoad} from '@dcloudio/uni-app';

onLoad(async () => {
  let loginRes = await login()
  console.log(loginRes)
  let param = {};
  param.code = loginRes.code;
  let res=await form("/userInfo/loginShopOauth", param);
  if (res.code === 200) {
	uni.setStorageSync('token', res.data.sessionId);
    uni.setStorageSync('userInfo', res.data);
    uni.setStorageSync('openId', res.data.openId)
    uni.setStorageSync('Authorization', res.data.sessionId);
  }
})

</script>

<style>
.container {
  width: 100vw;
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}
</style>
